package top.timous.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import top.timous.entity.Product;
import top.timous.entity.R;
import top.timous.service.IProductService;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 商品controller
 * @author Timous
 * @create 2022-02-24 15:04
 **/
@RestController
@RequestMapping("/product")
public class ProductController {

    @Autowired
    private IProductService iProductService;

    /*查询商品轮播图*/
    @GetMapping("/findSwiper")
    public R findSwiper(){
        List<Product> swiperList = iProductService.list(new QueryWrapper<Product>().eq("isSwiper", true).orderByAsc("swiperSort"));
        Map<String , Object> map = new HashMap<>();
        map.put("message" , swiperList);
        return R.ok(map);
    }

}
